home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / chicago.bst (.txt) < prev    next >
LaTeX Document  |  1992-08-30  |  37KB  |  1,329 lines

  1. %%% ====================================================================
  2. %%%  @BibTeX-style-file{
  3. %%%     author          = "Glenn Paulley",
  4. %%%     version         = "4",
  5. %%%     date            = "28 August 1992",
  6. %%%     time            = "10:23:39 199",
  7. %%%     filename        = "chicago.bst",
  8. %%%     address         = "Data Structuring Group
  9. %%%                        Department of Computer Science
  10. %%%                        University of Waterloo
  11. %%%                        Waterloo, Ontario, Canada
  12. %%%                        N2L 3G1",
  13. %%%     telephone       = "(519) 885-1211",
  14. %%%     FAX             = "(519) 885-1208",
  15. %%%     checksum        = "26323 1654 5143 37417",
  16. %%%     email           = "gnpaulle@bluebox.uwaterloo.ca",
  17. %%%     codetable       = "ISO/ASCII",
  18. %%%     keywords        = "",
  19. %%%     supported       = "yes",
  20. %%%     abstract        = "A BibTeX bibliography style that follows the
  21. %%%                        `B' reference style of the 13th Edition of
  22. %%%                        the Chicago Manual of Style. A detailed
  23. %%%                        feature list is given below.",
  24. %%%     docstring       = "The checksum field above contains a CRC-16
  25. %%%                        checksum as the first value, followed by the
  26. %%%                        equivalent of the standard UNIX wc (word
  27. %%%                        count) utility output of lines, words, and
  28. %%%                        characters.  This is produced by Robert
  29. %%%                        Solovay's checksum utility.",
  30. %%%  }
  31. %%% ====================================================================
  32. % "Chicago" BibTeX style, chicago.bst
  33. % ===================================
  34. % BibTeX `chicago' style file for BibTeX version 0.99c, LaTeX version 2.09
  35. % Place it in a file called chicago.bst in the BibTeX search path.
  36. % You need to include chicago.sty as a \documentstyle option.
  37. % (Placing it in the same directory as the LaTeX document should also work.)
  38. % This "chicago" style is based on newapa.bst (American Psych. Assoc.)
  39. % found at ymir.claremont.edu.
  40. %   Citation format: (author-last-name year)
  41. %             (author-last-name and author-last-name year)
  42. %             (author-last-name, author-last-name, and author-last-name year)
  43. %             (author-last-name et al. year)
  44. %             (author-last-name)
  45. %             author-last-name (year)
  46. %             (author-last-name and author-last-name)
  47. %             (author-last-name et al.)
  48. %             (year) or (year,year)
  49. %             year or year,year
  50. %   Reference list ordering: alphabetical by author or whatever passes
  51. %    for author in the absence of one.
  52. % This BibTeX style has support for abbreviated author lists and for
  53. %    year-only citations.  This is done by having the citations
  54. %    actually look like
  55. %    \citeauthoryear{full-author-info}{abbrev-author-info}{year}
  56. % The LaTeX style has to have the following (or similar)
  57. %     \let\@internalcite\cite
  58. %     \def\fullcite{\def\citeauthoryear##1##2##3{##1, ##3}\@internalcite}
  59. %     \def\fullciteA{\def\citeauthoryear##1##2##3{##1}\@internalcite}
  60. %     \def\shortcite{\def\citeauthoryear##1##2##3{##2, ##3}\@internalcite}
  61. %     \def\shortciteA{\def\citeauthoryear##1##2##3{##2}\@internalcite}
  62. %     \def\citeyear{\def\citeauthoryear##1##2##3{##3}\@internalcite}
  63. % These TeX macro definitions are found in chicago.sty. Additional
  64. % commands to manipulate different components of a citation can be defined
  65. % so that, for example, you can list author's names without parentheses
  66. % if using a citation as a noun or object in a sentence.
  67. % This file was originally copied from newapa.bst at ymir.claremont.edu.
  68. % Features of chicago.bst:
  69. % =======================
  70. % - full names used in citations, but abbreviated citations are available
  71. %   (see above)
  72. % - if an entry has a "month", then the month and year are also printed
  73. %   as part of that bibitem.
  74. % - all conjunctions use "and" instead of "\&"
  75. % - major modification from Chicago Manual of Style (13th ed.) is that
  76. %   only the first author in a reference appears last name first-
  77. %   additional authors appear as J. Q. Public.
  78. % - pages are listed as "pp. xx-xx" in all entry types except
  79. %   article entries.
  80. % - book, inbook, and manual use "location: publisher" (or organization)
  81. %   for address and publisher. All other types list publishers separately.
  82. % - "pp." are used to identify page numbers for all entry types except
  83. %   articles.
  84. % - organization is used as a citation label if neither author nor editor
  85. %   is present (for manuals).
  86. % - "et al." is used for long author and editor lists, or when "others"
  87. %   is used.
  88. % Modifications and bug fixes from newapa.bst:
  89. % ===========================================
  90. %   - added month, year to bib entries if month is present
  91. %   - fixed bug with In proceedings, added necessary comma after title
  92. %   - all conjunctions changed to "and" from "\&"
  93. %   - fixed bug with author labels in my.full.label: "et al." now is
  94. %        generated when "others" is an author name
  95. %   - major modification from Chicago Manual of Style (13th ed.) is that
  96. %     only the first author in a reference appears last name first-
  97. %     additional authors appear as J. Q. Public.
  98. %   - pages are listed as "pp. xx-xx" in all entry types except
  99. %     article entries. Unnecessary (IMHO) "()" around page numbers
  100. %     were removed, and page numbers now don't end with a period.
  101. %   - created chicago.sty for use with this bibstyle (required).
  102. %   - fixed bugs in FUNCTION {format.vol.num.pages} for missing volume,
  103. %     number, and /or pages. Renamed to format.jour.vol.
  104. %   - fixed bug in formatting booktitles: additional period an error if
  105. %     book has a volume.
  106. %   - fixed bug: editors usually given redundant period before next clause
  107. %     (format.editors.dot) removed.
  108. %   - added label support for organizations, if both author and editor
  109. %     are missing (from alpha.bst). If organization is too long, then
  110. %     the key field is used for abbreviated citations.
  111. %   - In proceedings or books of several volumes, no comma was written
  112. %     between the "Volume x" and the page numbers (this was intentional
  113. %     in newapa.bst). Fixed.
  114. %   - Some journals may not have volumes/numbers, only month/year (eg.
  115. %     IEEE Computer). Fixed bug in article style that assumed volume/number
  116. %     was always present.
  117. % Original documentation for newapa.sty:
  118. % =====================================
  119. % This version was made by modifying the master file made by
  120. % Oren Patashnik (PATASHNIK@SCORE.STANFORD.EDU), and the 'named' BibTeX
  121. % style of Peter F. Patel-Schneider.
  122. % Copyright (C) 1985, all rights reserved.
  123. % Copying of this file is authorized only if either
  124. % (1) you make absolutely no changes to your copy, including name, or
  125. % (2) if you do make changes, you name it something other than 'newapa.bst'.
  126. % There are undoubtably bugs in this style.  If you make bug fixes,
  127. % improvements, etc.  please let me know.  My e-mail address is:
  128. %    spencer@cgrg.ohio.state.edu or 71160.3141@compuserve.com
  129. % This style was made from 'plain.bst', 'named.bst', and 'apalike.bst',
  130. % with lots of tweaking to make it look like APA style, along with tips
  131. % from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.
  132. ENTRY
  133.   { address
  134.     author
  135.     booktitle
  136.     chapter
  137.     edition
  138.     editor
  139.     howpublished
  140.     institution
  141.     journal
  142.     key
  143.     month
  144.     note
  145.     number
  146.     organization
  147.     pages
  148.     publisher
  149.     school
  150.     series
  151.     title
  152.     type
  153.     volume
  154.     year
  155.   { label.year extra.label sort.year sort.label }
  156. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  157. FUNCTION {init.state.consts}
  158. { #0 'before.all :=
  159.   #1 'mid.sentence :=
  160.   #2 'after.sentence :=
  161.   #3 'after.block :=
  162. STRINGS { s t u }
  163. FUNCTION {output.nonnull}
  164. { 's :=
  165.   output.state mid.sentence =
  166.     { ", " * write$ }
  167.     { output.state after.block =
  168.     { add.period$ write$
  169.       newline$
  170.       "\newblock " write$
  171.     }
  172.     { output.state before.all =
  173.         'write$
  174.         { add.period$ " " * write$ }
  175.       if$
  176.     }
  177.       if$
  178.       mid.sentence 'output.state :=
  179.     }
  180.   if$
  181. % Use a colon to separate output. Used only for address/publisher
  182. % combination in book/inbook types, address/institution for manuals,
  183. % and organization:publisher for proceedings (inproceedings).
  184. FUNCTION {output.nonnull.colon}
  185. { 's :=
  186.   output.state mid.sentence =
  187.     { ": " * write$ }
  188.     { output.state after.block =
  189.     { add.period$ write$
  190.       newline$
  191.       "\newblock " write$
  192.     }
  193.     { output.state before.all =
  194.         'write$
  195.         { add.period$ " " * write$ }
  196.       if$
  197.     }
  198.       if$
  199.       mid.sentence 'output.state :=
  200.     }
  201.   if$
  202. FUNCTION {output}
  203. { duplicate$ empty$
  204.     'pop$
  205.     'output.nonnull
  206.   if$
  207. FUNCTION {output.colon}
  208. { duplicate$ empty$
  209.     'pop$
  210.     'output.nonnull.colon
  211.   if$
  212. FUNCTION {output.check}
  213. { 't :=
  214.   duplicate$ empty$
  215.     { pop$ "empty " t * " in " * cite$ * warning$ }
  216.     'output.nonnull
  217.   if$
  218. FUNCTION {output.check.colon}
  219. { 't :=
  220.   duplicate$ empty$
  221.     { pop$ "empty " t * " in " * cite$ * warning$ }
  222.     'output.nonnull.colon
  223.   if$
  224. FUNCTION {output.year.check}
  225. { year empty$
  226.      { "empty year in " cite$ * warning$ }
  227.      { write$
  228.         " (" year * extra.label *
  229.        month empty$
  230.           { ")" * }
  231.           { ", " * month * ")" * }
  232.        if$
  233.        mid.sentence 'output.state :=
  234.      }
  235.   if$
  236. FUNCTION {fin.entry}
  237. { add.period$
  238.   write$
  239.   newline$
  240. FUNCTION {new.block}
  241. { output.state before.all =
  242.     'skip$
  243.     { after.block 'output.state := }
  244.   if$
  245. FUNCTION {new.sentence}
  246. { output.state after.block =
  247.     'skip$
  248.     { output.state before.all =
  249.     'skip$
  250.     { after.sentence 'output.state := }
  251.       if$
  252.     }
  253.   if$
  254. FUNCTION {not}
  255. {   { #0 }
  256.     { #1 }
  257.   if$
  258. FUNCTION {and}
  259. {   'skip$
  260.     { pop$ #0 }
  261.   if$
  262. FUNCTION {or}
  263. {   { pop$ #1 }
  264.     'skip$
  265.   if$
  266. FUNCTION {new.block.checka}
  267. { empty$
  268.     'skip$
  269.     'new.block
  270.   if$
  271. FUNCTION {new.block.checkb}
  272. { empty$
  273.   swap$ empty$
  274.   and
  275.     'skip$
  276.     'new.block
  277.   if$
  278. FUNCTION {new.sentence.checka}
  279. { empty$
  280.     'skip$
  281.     'new.sentence
  282.   if$
  283. FUNCTION {new.sentence.checkb}
  284. { empty$
  285.   swap$ empty$
  286.   and
  287.     'skip$
  288.     'new.sentence
  289.   if$
  290. FUNCTION {field.or.null}
  291. { duplicate$ empty$
  292.     { pop$ "" }
  293.     'skip$
  294.   if$
  295. % Emphasize the top string on the stack.
  296. FUNCTION {emphasize}
  297. { duplicate$ empty$
  298.     { pop$ "" }
  299.     { "{\em " swap$ * "}" * }
  300.   if$
  301. % Emphasize the top string on the stack, but add a trailing space.
  302. FUNCTION {emphasize.space}
  303. { duplicate$ empty$
  304.     { pop$ "" }
  305.     { "{\em " swap$ * "\/}" * }
  306.   if$
  307. INTEGERS { nameptr namesleft numnames }
  308. % Format bibliographical entries with the first author last name first,
  309. % and subsequent authors with initials followed by last name.
  310. % All names are formatted in this routine.
  311. FUNCTION {format.names}
  312. { 's :=
  313.   #1 'nameptr :=               % nameptr = 1;
  314.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  315.   numnames 'namesleft :=
  316.     { namesleft #0 > }
  317.     { nameptr #1 =
  318.         {s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := }
  319.         {s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
  320.       if$
  321.       nameptr #1 >
  322.         { namesleft #1 >
  323.               { ", " * t * }
  324.               { numnames #2 >
  325.                   { "," * }
  326.                   'skip$
  327.                 if$
  328.                 t "others" =
  329.                     { " et~al." * }
  330.                     { " and " * t * } % from Chicago Manual of Style
  331.                   if$
  332.                }
  333.                if$
  334.              }
  335.             't
  336.         if$
  337.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  338.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  339.     }
  340.   while$
  341. FUNCTION {my.full.label}
  342. { 's :=
  343.   #1 'nameptr :=               % nameptr = 1;
  344.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  345.   numnames 'namesleft :=
  346.     { namesleft #0 > }
  347.     { s nameptr "{vv~}{ll}" format.name$ 't :=  % get the next name
  348.       nameptr #1 >
  349.         { namesleft #1 >
  350.               { ", " * t * }
  351.               { numnames #2 >
  352.                   { "," * }
  353.                   'skip$
  354.                 if$
  355.                 t "others" =
  356.                     { " et~al." * }
  357.                     { " and " * t * } % from Chicago Manual of Style
  358.                   if$
  359.                }
  360.                if$
  361.              }
  362.             't
  363.         if$
  364.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  365.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  366.     }
  367.   while$
  368. FUNCTION {format.names.fml}
  369. % Format names in "familiar" format, with first initial followed by
  370. % last name. Like format.names, ALL names are formatted.
  371. { 's :=
  372.   #1 'nameptr :=               % nameptr = 1;
  373.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  374.   numnames 'namesleft :=
  375.     { namesleft #0 > }
  376.     { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
  377.       nameptr #1 >
  378.         { namesleft #1 >
  379.               { ", " * t * }
  380.                { numnames #2 >
  381.                     { "," * }
  382.                     'skip$
  383.                   if$
  384.                   t "others" =
  385.                         { " et~al." * }
  386.                         { " and " * t * }
  387. %                       { " \& " * t * }
  388.                       if$
  389.                 }
  390.                if$
  391.              }
  392.             't
  393.         if$
  394.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  395.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  396.     }
  397.   while$
  398. FUNCTION {format.authors}
  399. { author empty$
  400.     { "" }
  401.     { author format.names }
  402.   if$
  403. FUNCTION {format.key}
  404. { empty$
  405.     { key field.or.null }
  406.     { "" }
  407.   if$
  408. % Format editor names for use in the "in" types: inbook, incollection,
  409. % inproceedings: first initial, then last names. When editors are the
  410. % LABEL for an entry, then format.editor is used which lists editors
  411. % by last name first.
  412. FUNCTION {format.editors.fml}
  413. { editor empty$
  414.     { "" }
  415.     { editor format.names.fml
  416.       editor num.names$ #1 >
  417.     { " (Eds.)" * }
  418.     { " (Ed.)" * }
  419.       if$
  420.     }
  421.   if$
  422. % Format editor names for use in labels, last names first.
  423. FUNCTION {format.editors}
  424. { editor empty$
  425.     { "" }
  426.     { editor format.names
  427.       editor num.names$ #1 >
  428.     { " (Eds.)" * }
  429.     { " (Ed.)" * }
  430.       if$
  431.     }
  432.   if$
  433. FUNCTION {format.title}
  434. { title empty$
  435.     { "" }
  436.     { title "t" change.case$ }
  437.   if$
  438. % Note that the APA style requres case changes
  439. % in article titles. The following does not
  440. % change cases. If you perfer it, uncomment the
  441. % following and comment out the above.
  442. %FUNCTION {format.title}
  443. %{ title empty$
  444. %    { "" }
  445. %    { title }
  446. %  if$
  447. FUNCTION {n.dashify}
  448. { 't :=
  449.     { t empty$ not }
  450.     { t #1 #1 substring$ "-" =
  451.     { t #1 #2 substring$ "--" = not
  452.         { "--" *
  453.           t #2 global.max$ substring$ 't :=
  454.         }
  455.         {   { t #1 #1 substring$ "-" = }
  456.         { "-" *
  457.           t #2 global.max$ substring$ 't :=
  458.         }
  459.           while$
  460.         }
  461.       if$
  462.     }
  463.     { t #1 #1 substring$ *
  464.       t #2 global.max$ substring$ 't :=
  465.     }
  466.       if$
  467.     }
  468.   while$
  469. FUNCTION {format.btitle}
  470. { edition empty$
  471.   { title emphasize }
  472.   { title empty$
  473.     { title emphasize }
  474.     { volume empty$     % gnp - check for volume, then don't need period
  475.        { "{\em " title * "\/} (" * edition * " ed.)" * "." * }
  476.        { "{\em " title * "\/} (" * edition * " ed.)" * }
  477.       if$
  478.     }
  479.     if$
  480.   if$
  481. FUNCTION {format.emphasize.booktitle}
  482. { edition empty$
  483.   { booktitle emphasize }
  484.   { booktitle empty$
  485.     { booktitle emphasize }
  486.     { volume empty$    % gnp - extra period an error if book has a volume
  487.         { "{\em " booktitle * "\/} (" * edition * " ed.)" * "." *}
  488.         { "{\em " booktitle * "\/} (" * edition * " ed.)" * }
  489.       if$
  490.       }
  491.     if$
  492.     }
  493.   if$
  494. FUNCTION {tie.or.space.connect}
  495. { duplicate$ text.length$ #3 <
  496.     { "~" }
  497.     { " " }
  498.   if$
  499.   swap$ * *
  500. FUNCTION {either.or.check}
  501. { empty$
  502.     'pop$
  503.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  504.   if$
  505. FUNCTION {format.bvolume}
  506. { volume empty$
  507.     { "" }
  508.     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  509.       series empty$
  510.         'skip$
  511.         { " of " * series emphasize * }
  512.       if$
  513.       "volume and number" number either.or.check
  514.     }
  515.   if$
  516. FUNCTION {format.number.series}
  517. { volume empty$
  518.     { number empty$
  519.     { series field.or.null }
  520.     { output.state mid.sentence =
  521.         { "Number" } % gnp - changed to mixed case always
  522.         { "Number" }
  523.       if$
  524.       number tie.or.space.connect
  525.       series empty$
  526.         { "there's a number but no series in " cite$ * warning$ }
  527.         { " in " * series * }
  528.       if$
  529.     }
  530.       if$
  531.     }
  532.     { "" }
  533.   if$
  534. INTEGERS { multiresult }
  535. FUNCTION {multi.page.check}
  536. { 't :=
  537.   #0 'multiresult :=
  538.     { multiresult not
  539.       t empty$ not
  540.       and
  541.     }
  542.     { t #1 #1 substring$
  543.       duplicate$ "-" =
  544.       swap$ duplicate$ "," =
  545.       swap$ "+" =
  546.       or or
  547.     { #1 'multiresult := }
  548.     { t #2 global.max$ substring$ 't := }
  549.       if$
  550.     }
  551.   while$
  552.   multiresult
  553. FUNCTION {format.pages}
  554. { pages empty$
  555.   { "" }
  556.   { pages multi.page.check
  557.     { "pp.\ " pages n.dashify tie.or.space.connect } % gnp - removed ()
  558.     { "pp.\ " pages tie.or.space.connect }
  559.     if$
  560.   if$
  561. % By Young (and Spencer)
  562. % GNP - fixed bugs with missing volume, number, and/or pages
  563. % Format journal, volume, number, pages for article types.
  564. FUNCTION {format.jour.vol}
  565. { journal empty$
  566.     { "no journal in " cite$ * warning$
  567.       "" }
  568.     { journal emphasize.space }
  569.     if$
  570.   number empty$
  571.     { volume empty$
  572.        { "no number and no volume in " cite$ * warning$
  573.          "" * }
  574.        { "~{\em " * Volume * "}" * }
  575.       if$
  576.     }
  577.     { volume empty$
  578.       {"no volume for " cite$ * warning$
  579.        "~(" * number * ")" * }
  580.       { "~" *
  581.         volume emphasize.space
  582.         "(" * number * ")" * * }
  583.       if$
  584.     }
  585.   if$
  586.   pages empty$
  587.     {"page numbers missing in " cite$ * warning$
  588.      "" * } % gnp - place a null string on the stack for output
  589.     { duplicate$ empty$
  590.       { pop$ format.pages }
  591.       { ", " *  pages n.dashify * } % gnp - removed pp. for articles
  592.       if$
  593.     }
  594.   if$
  595. FUNCTION {format.chapter.pages}
  596. { chapter empty$
  597.     'format.pages
  598.     { type empty$
  599.         { "Chapter" } % gnp - changed to mixed case
  600.         { type "t" change.case$ }
  601.       if$
  602.       chapter tie.or.space.connect
  603.       pages empty$
  604.         {"page numbers missing in " cite$ * warning$} % gnp - added check
  605.         { ", " * format.pages * }
  606.       if$
  607.     }
  608.   if$
  609. FUNCTION {format.in.ed.booktitle}
  610. { booktitle empty$
  611.   { "" }
  612.   { editor empty$
  613.     { "In " format.emphasize.booktitle * }
  614.     { "In " format.editors.fml * ", " * format.emphasize.booktitle * }
  615.     if$
  616.   if$
  617. FUNCTION {format.thesis.type}
  618. { type empty$
  619.     'skip$
  620.     { pop$
  621.       type "t" change.case$
  622.     }
  623.   if$
  624. FUNCTION {format.tr.number}
  625. { type empty$
  626.     { "Technical Report" }
  627.     'type
  628.   if$
  629.   number empty$
  630.     { "t" change.case$ }
  631.     { number tie.or.space.connect }
  632.   if$
  633. FUNCTION {format.article.crossref}
  634. { "See"
  635.   "\citeN{" * crossref * "}" *
  636. FUNCTION {format.crossref.editor}
  637. { editor #1 "{vv~}{ll}" format.name$
  638.   editor num.names$ duplicate$
  639.   #2 >
  640.     { pop$ " et~al." * }
  641.     { #2 <
  642.     'skip$
  643.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  644.         { " et~al." * }
  645.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  646.       if$
  647.     }
  648.       if$
  649.     }
  650.   if$
  651. FUNCTION {format.book.crossref}
  652. { volume empty$
  653.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  654.       "In "
  655.     }
  656.     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  657.       " of " *
  658.     }
  659.   if$
  660.   editor empty$
  661.   editor field.or.null author field.or.null =
  662.     { key empty$
  663.     { series empty$
  664.         { "need editor, key, or series for " cite$ * " to crossref " *
  665.           crossref * warning$
  666.           "" *
  667.         }
  668.         { "{\em " * series * "\/}" * }
  669.       if$
  670.     }
  671.     { key * }
  672.       if$
  673.     }
  674.     { format.crossref.editor * }
  675.   if$
  676.   " \citeN{" * crossref * "}" *
  677. FUNCTION {format.incoll.inproc.crossref}
  678. { "See"
  679.   " \citeN{" * crossref * "}" *
  680. % format.lab.names:
  681. % determines "short" names for the abbreviated author information.
  682. % "Long" labels are created in calc.label, using the routine my.full.label
  683. % to format author and editor fields.
  684. % There are 4 cases for labels.   (n=3 in the example)
  685. % a) one author             Foo
  686. % b) one to n               Foo, Bar and Baz
  687. % c) use of "and others"    Foo, Bar et al.
  688. % d) more than n            Foo et al.
  689. FUNCTION {format.lab.names}
  690. { 's :=
  691.   s num.names$ 'numnames :=
  692.   numnames #2 >    % change number to number of others allowed before
  693.            % forcing "et al".
  694.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  695.     {
  696.       numnames #1 - 'namesleft :=
  697.       #2 'nameptr :=
  698.       s #1 "{vv~}{ll}" format.name$
  699.     { namesleft #0 > }
  700.     { nameptr numnames =
  701.         { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  702.         { " et~al." * }
  703.         { " and " * s nameptr "{vv~}{ll}" format.name$ * }
  704.           if$
  705.         }
  706.         { ", " * s nameptr "{vv~}{ll}" format.name$ * }
  707.       if$
  708.       nameptr #1 + 'nameptr :=
  709.       namesleft #1 - 'namesleft :=
  710.       while$
  711.     }
  712.   if$
  713. FUNCTION {author.key.label}
  714. { author empty$
  715.     { key empty$
  716.           { "no key, author in " cite$ * warning$
  717.             cite$ #1 #3 substring$ }
  718.          'key
  719.       if$
  720.     }
  721.     { author format.lab.names }
  722.   if$
  723. FUNCTION {editor.key.label}
  724. { editor empty$
  725.     { key empty$
  726.           { "no key, editor in " cite$ * warning$
  727.             cite$ #1 #3 substring$ }
  728.           'key
  729.         if$
  730.      }
  731.      { editor format.lab.names }
  732.   if$
  733. FUNCTION {author.key.organization.label}
  734. % added - gnp. Provide label formatting by organization if author is null.
  735. { author empty$
  736.     { organization empty$
  737.     { key empty$
  738.         { "no key, author or organization in " cite$ * warning$
  739.               cite$ #1 #3 substring$ }
  740.         'key
  741.       if$
  742.         { organization }
  743.       if$
  744.     }
  745.     { author format.lab.names }
  746.   if$
  747. FUNCTION {editor.key.organization.label}
  748. % added - gnp. Provide label formatting by organization if editor is null.
  749. { editor empty$
  750.     { organization empty$
  751.     { key empty$
  752.         { "no key, editor or organization in " cite$ * warning$
  753.               cite$ #1 #3 substring$ }
  754.         'key
  755.       if$
  756.         { organization }
  757.       if$
  758.     }
  759.     { editor format.lab.names }
  760.   if$
  761. FUNCTION {author.editor.key.label}
  762. { author empty$
  763.     { editor empty$
  764.           { key empty$
  765.                { "no key, author, or editor in " cite$ * warning$
  766.                  cite$ #1 #3 substring$ }
  767.              'key
  768.            if$
  769.          }
  770.           { editor format.lab.names }
  771.       if$
  772.     }
  773.     { author format.lab.names }
  774.   if$
  775. FUNCTION {calc.label}
  776. % Changed - GNP. See also author.organization.sort, editor.organization.sort
  777. % Form label for BibTeX entry. The classification of which fields are used
  778. % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
  779. % The change here from newapa is to also include organization as a
  780. % citation label if author or editor is missing.
  781. { type$ "book" =
  782.   type$ "inbook" =
  783.     'author.editor.key.label
  784.     { type$ "proceedings" =
  785.     'editor.key.organization.label
  786.     { type$ "manual" =
  787.         'author.key.organization.label
  788.         'author.key.label
  789.       if$
  790.       if$
  791.     }
  792.   if$
  793.   author empty$  % generate the full label citation information.
  794.     { editor empty$
  795.         { organization empty$
  796.            { "no author, editor, or organization in " cite$ * warning$
  797.              "??" }
  798.            { organization }
  799.            if$
  800.         }
  801.         { editor my.full.label }
  802.         if$
  803.     }
  804.     { author my.full.label }
  805.   if$
  806. % leave label on the stack, to be popped when required.
  807.   "}{" * swap$ * "}{" *
  808. %  year field.or.null purify$ #-1 #4 substring$ *
  809. % save the year for sort processing afterwards (adding a, b, c, etc.)
  810.   year field.or.null purify$ #-1 #4 substring$
  811.   'label.year :=
  812. FUNCTION {output.bibitem}
  813. { newline$
  814.   "\bibitem[\protect\citeauthoryear{" write$
  815.   calc.label write$
  816.   sort.year write$
  817.   "}]{" write$
  818.   cite$ write$
  819.   "}" write$
  820.   newline$
  821.   before.all 'output.state :=
  822. FUNCTION {article}
  823. { output.bibitem
  824.   format.authors
  825.   "author" output.check
  826.   author format.key output          % added
  827.   output.year.check                 % added
  828.   new.block
  829.   format.title
  830.   "title" output.check
  831.   new.block
  832.   crossref missing$
  833.     { format.jour.vol output
  834.     }
  835.     { format.article.crossref output.nonnull
  836.       format.pages output
  837.     }
  838.   if$
  839.   new.block
  840.   note output
  841.   fin.entry
  842. FUNCTION {book}
  843. { output.bibitem
  844.   author empty$
  845.     { format.editors
  846.       "author and editor" output.check }
  847.     { format.authors
  848.       output.nonnull
  849.       crossref missing$
  850.         { "author and editor" editor either.or.check }
  851.         'skip$
  852.       if$
  853.     }
  854.   if$
  855.   output.year.check       % added
  856.   new.block
  857.   format.btitle
  858.   "title" output.check
  859.   crossref missing$
  860.     { format.bvolume output
  861.       new.block
  862.       format.number.series output
  863.       new.sentence
  864.       address output
  865.       publisher "publisher" output.check.colon
  866.     }
  867.     { new.block
  868.       format.book.crossref output.nonnull
  869.     }
  870.   if$
  871.   new.block
  872.   note output
  873.   fin.entry
  874. FUNCTION {booklet}
  875. { output.bibitem
  876.   format.authors output
  877.   author format.key output          % added
  878.   output.year.check                 % added
  879.   new.block
  880.   format.title
  881.   "title" output.check
  882.   new.block
  883.   howpublished output
  884.   address output
  885.   new.block
  886.   note output
  887.   fin.entry
  888. FUNCTION {inbook}
  889. { output.bibitem
  890.   author empty$
  891.     { format.editors
  892.       "author and editor" output.check
  893.     }
  894.     { format.authors output.nonnull
  895.       crossref missing$
  896.     { "author and editor" editor either.or.check }
  897.     'skip$
  898.       if$
  899.     }
  900.   if$
  901.   output.year.check                 % added
  902.   new.block
  903.   format.btitle
  904.   "title" output.check
  905.   crossref missing$
  906.     { format.bvolume output
  907.       format.chapter.pages
  908.       "chapter and pages" output.check
  909.       new.block
  910.       format.number.series output
  911.       new.sentence
  912.       address output
  913.       publisher
  914.       "publisher" output.check.colon
  915.     }
  916.     { format.chapter.pages "chapter and pages" output.check
  917.       new.block
  918.       format.book.crossref output.nonnull
  919.     }
  920.   if$
  921.   new.block
  922.   note output
  923.   fin.entry
  924. FUNCTION {incollection}
  925. { output.bibitem
  926.   format.authors
  927.   "author" output.check
  928.   author format.key output       % added
  929.   output.year.check              % added
  930.   new.block
  931.   format.title
  932.   "title" output.check
  933.   new.block
  934.   crossref missing$
  935.   { format.in.ed.booktitle
  936.     "booktitle" output.check
  937.     format.bvolume output
  938.     format.number.series output
  939.     format.chapter.pages output % gnp - was special.output.nonnull
  940. %                                 left out comma before page numbers
  941.     new.sentence
  942.     address output
  943.     publisher "publisher" output.check.colon
  944.   { format.incoll.inproc.crossref
  945.     output.nonnull
  946.     format.chapter.pages output
  947.   if$
  948.   new.block
  949.   note output
  950.   fin.entry
  951. FUNCTION {inproceedings}
  952. { output.bibitem
  953.   format.authors
  954.   "author" output.check
  955.   author format.key output            % added
  956.   output.year.check                   % added
  957.   new.block
  958.   format.title
  959.   "title" output.check
  960.   new.block
  961.   crossref missing$
  962.     { format.in.ed.booktitle
  963.       "booktitle" output.check
  964.       format.bvolume output
  965.       format.number.series output
  966.       address output
  967.       format.pages output
  968.       new.sentence
  969.       organization output
  970.       publisher output.colon
  971.       }
  972.     { format.incoll.inproc.crossref output.nonnull
  973.       format.pages output
  974.     }
  975.   if$
  976.   new.block
  977.   note output
  978.   fin.entry
  979. FUNCTION {conference} { inproceedings }
  980. FUNCTION {manual}
  981. { output.bibitem
  982.   author empty$
  983.     { editor empty$
  984.       { organization "organization" output.check
  985.         organization format.key output }  % if all else fails, use key
  986.       { format.editors "author and editor" output.check }
  987.       if$
  988.     }
  989.     { format.authors output.nonnull }
  990.     if$
  991.   output.year.check                 % added
  992.   new.block
  993.   format.btitle
  994.   "title" output.check
  995.   organization address new.block.checkb
  996. % Reversed the order of "address" and "organization", added the ":".
  997.   address output
  998.   organization "organization" output.check.colon
  999. %  address output
  1000. %  ":" output
  1001. %  organization output
  1002.   new.block
  1003.   note output
  1004.   fin.entry
  1005. FUNCTION {mastersthesis}
  1006. { output.bibitem
  1007.   format.authors
  1008.   "author" output.check
  1009.   author format.key output          % added
  1010.   output.year.check                 % added
  1011.   new.block
  1012.   format.title
  1013.   "title" output.check
  1014.   new.block
  1015.   "Master's thesis" format.thesis.type output.nonnull
  1016.   school "school" output.check
  1017.   address output
  1018.   new.block
  1019.   note output
  1020.   fin.entry
  1021. FUNCTION {misc}
  1022. { output.bibitem
  1023.   format.authors output
  1024.   author format.key output            % added
  1025.   output.year.check                   % added
  1026.   title howpublished new.block.checkb
  1027.   format.title output
  1028.   new.block
  1029.   howpublished output
  1030.   new.block
  1031.   note output
  1032.   fin.entry
  1033. FUNCTION {phdthesis}
  1034. { output.bibitem
  1035.   format.authors
  1036.   "author" output.check
  1037.   author format.key output            % added
  1038.   output.year.check                   % added
  1039.   new.block
  1040.   format.btitle
  1041.   "title" output.check
  1042.   new.block
  1043.   "Ph.\ D. thesis" format.thesis.type output.nonnull
  1044.   school "school" output.check
  1045.   address output
  1046.   new.block
  1047.   note output
  1048.   fin.entry
  1049. FUNCTION {proceedings}
  1050. { output.bibitem
  1051.   editor empty$
  1052.     { organization output
  1053.       organization format.key output }  % gnp - changed from author format.key
  1054.     { format.editors output.nonnull }
  1055.   if$
  1056. % author format.key output             % gnp - removed (should be either
  1057. %                                        editor or organization
  1058.   output.year.check                    % added (newapa)
  1059.   new.block
  1060.   format.btitle
  1061.   "title" output.check
  1062.   format.bvolume output
  1063.   format.number.series output
  1064.   address output
  1065.   new.sentence
  1066.   organization output
  1067.   publisher output.colon
  1068.   new.block
  1069.   note output
  1070.   fin.entry
  1071. FUNCTION {techreport}
  1072. { output.bibitem
  1073.   format.authors
  1074.   "author" output.check
  1075.   author format.key output             % added
  1076.   output.year.check                    % added
  1077.   new.block
  1078.   format.title
  1079.   "title" output.check
  1080.   new.block
  1081.   format.tr.number output.nonnull
  1082.   institution
  1083.   "institution" output.check
  1084.   address output
  1085.   new.block
  1086.   note output
  1087.   fin.entry
  1088. FUNCTION {unpublished}
  1089. { output.bibitem
  1090.   format.authors
  1091.   "author" output.check
  1092.   author format.key output              % added
  1093.   output.year.check                      % added
  1094.   new.block
  1095.   format.title
  1096.   "title" output.check
  1097.   new.block
  1098.   note "note" output.check
  1099.   fin.entry
  1100. FUNCTION {default.type} { misc }
  1101. MACRO {jan} {"January"}
  1102. MACRO {feb} {"February"}
  1103. MACRO {mar} {"March"}
  1104. MACRO {apr} {"April"}
  1105. MACRO {may} {"May"}
  1106. MACRO {jun} {"June"}
  1107. MACRO {jul} {"July"}
  1108. MACRO {aug} {"August"}
  1109. MACRO {sep} {"September"}
  1110. MACRO {oct} {"October"}
  1111. MACRO {nov} {"November"}
  1112. MACRO {dec} {"December"}
  1113. MACRO {acmcs} {"ACM Computing Surveys"}
  1114. MACRO {acta} {"Acta Informatica"}
  1115. MACRO {ai} {"Artificial Intelligence"}
  1116. MACRO {cacm} {"Communications of the ACM"}
  1117. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1118. MACRO {ibmsj} {"IBM Systems Journal"}
  1119. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1120. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1121. MACRO {ieeetcad}
  1122.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1123. MACRO {ipl} {"Information Processing Letters"}
  1124. MACRO {jacm} {"Journal of the ACM"}
  1125. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1126. MACRO {scp} {"Science of Computer Programming"}
  1127. MACRO {sicomp} {"SIAM Journal on Computing"}
  1128. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1129. MACRO {tods} {"ACM Transactions on Database Systems"}
  1130. MACRO {tog} {"ACM Transactions on Graphics"}
  1131. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1132. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1133. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1134. MACRO {tcs} {"Theoretical Computer Science"}
  1135. FUNCTION {sortify}
  1136. { purify$
  1137.   "l" change.case$
  1138. INTEGERS { len }
  1139. FUNCTION {chop.word}
  1140. { 's :=
  1141.   'len :=
  1142.   s #1 len substring$ =
  1143.     { s len #1 + global.max$ substring$ }
  1144.     's
  1145.   if$
  1146. FUNCTION {sort.format.names}
  1147. { 's :=
  1148.   #1 'nameptr :=
  1149.   s num.names$ 'numnames :=
  1150.   numnames 'namesleft :=
  1151.     { namesleft #0 > }
  1152.     { nameptr #1 >
  1153.           { "   " * }
  1154.          'skip$
  1155.       if$
  1156.       s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't :=
  1157.       nameptr numnames = t "others" = and
  1158.           { " et~al" * }
  1159.           { t sortify * }
  1160.       if$
  1161.       nameptr #1 + 'nameptr :=
  1162.       namesleft #1 - 'namesleft :=
  1163.     }
  1164.   while$
  1165. FUNCTION {sort.format.title}
  1166. { 't :=
  1167.   "A " #2
  1168.     "An " #3
  1169.       "The " #4 t chop.word
  1170.     chop.word
  1171.   chop.word
  1172.   sortify
  1173.   #1 global.max$ substring$
  1174. FUNCTION {author.sort}
  1175. { author empty$
  1176.     { key empty$
  1177.          { "to sort, need author or key in " cite$ * warning$
  1178.            "" }
  1179.          { key sortify }
  1180.       if$
  1181.     }
  1182.     { author sort.format.names }
  1183.   if$
  1184. FUNCTION {editor.sort}
  1185. { editor empty$
  1186.     { key empty$
  1187.          { "to sort, need editor or key in " cite$ * warning$
  1188.            ""
  1189.          }
  1190.          { key sortify }
  1191.       if$
  1192.     }
  1193.     { editor sort.format.names }
  1194.   if$
  1195. FUNCTION {author.editor.sort}
  1196. { author empty$
  1197.     { "missing author in " cite$ * warning$
  1198.       editor empty$
  1199.          { key empty$
  1200.              { "to sort, need author, editor, or key in " cite$ * warning$
  1201.                ""
  1202.              }
  1203.              { key sortify }
  1204.            if$
  1205.          }
  1206.          { editor sort.format.names }
  1207.       if$
  1208.     }
  1209.     { author sort.format.names }
  1210.   if$
  1211. FUNCTION {author.organization.sort}
  1212. % added - GNP. Stack author or organization for sorting (from alpha.bst).
  1213. % Unlike alpha.bst, we need entire names, not abbreviations
  1214. { author empty$
  1215.     { organization empty$
  1216.     { key empty$
  1217.         { "to sort, need author, organization, or key in " cite$ * warning$
  1218.           ""
  1219.         }
  1220.         { key sortify }
  1221.       if$
  1222.     { organization sortify }
  1223.       if$
  1224.     }
  1225.     { author sort.format.names }
  1226.   if$
  1227. FUNCTION {editor.organization.sort}
  1228. % added - GNP. Stack editor or organization for sorting (from alpha.bst).
  1229. % Unlike alpha.bst, we need entire names, not abbreviations
  1230. { editor empty$
  1231.     { organization empty$
  1232.     { key empty$
  1233.         { "to sort, need editor, organization, or key in " cite$ * warning$
  1234.           ""
  1235.         }
  1236.         { key sortify }
  1237.       if$
  1238.     { organization sortify }
  1239.       if$
  1240.     }
  1241.     { editor sort.format.names }
  1242.   if$
  1243. FUNCTION {presort}
  1244. % Presort creates the bibentry's label via a call to calc.label, and then
  1245. % sorts the entries based on entry type. Chicago.bst adds support for
  1246. % including organizations as the sort key; the following is stolen from
  1247. % alpha.bst.
  1248. { calc.label sortify % recalculate bibitem label
  1249.   year field.or.null purify$ #-1 #4 substring$ * % add year
  1250.   "    "
  1251.   type$ "book" =
  1252.   type$ "inbook" =
  1253.     'author.editor.sort
  1254.     { type$ "proceedings" =
  1255.     'editor.organization.sort
  1256.     { type$ "manual" =
  1257.         'author.organization.sort
  1258.         'author.sort
  1259.       if$
  1260.       if$
  1261.     }
  1262.   if$
  1263.   #1 entry.max$ substring$        % added for newapa
  1264.   'sort.label :=                  % added for newapa
  1265.   sort.label                      % added for newapa
  1266.   "    "
  1267.   title field.or.null
  1268.   sort.format.title
  1269.   #1 entry.max$ substring$
  1270.   'sort.key$ :=
  1271. ITERATE {presort}
  1272. SORT             % by label, year, author/editor, title
  1273. STRINGS { last.label next.extra }
  1274. INTEGERS { last.extra.num }
  1275. FUNCTION {initialize.extra.label.stuff}
  1276. { #0 int.to.chr$ 'last.label :=
  1277.   "" 'next.extra :=
  1278.   #0 'last.extra.num :=
  1279. FUNCTION {forward.pass}
  1280. % Pass through all entries, comparing current entry to last one.
  1281. % Need to concatenate year to the stack (done by calc.label) to determine
  1282. % if two entries are the same (see presort)
  1283. { last.label
  1284.   calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
  1285.   #1 entry.max$ substring$ =     % are they equal?
  1286.      { last.extra.num #1 + 'last.extra.num :=
  1287.        last.extra.num int.to.chr$ 'extra.label :=
  1288.      }
  1289.      { "a" chr.to.int$ 'last.extra.num :=
  1290.        "" 'extra.label :=
  1291.        calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
  1292.        #1 entry.max$ substring$ 'last.label := % assign to last.label
  1293.      }
  1294.   if$
  1295. FUNCTION {reverse.pass}
  1296. { next.extra "b" =
  1297.     { "a" 'extra.label := }
  1298.      'skip$
  1299.   if$
  1300.   label.year extra.label * 'sort.year :=
  1301.   extra.label 'next.extra :=
  1302. EXECUTE {initialize.extra.label.stuff}
  1303. ITERATE {forward.pass}
  1304. REVERSE {reverse.pass}
  1305. FUNCTION {bib.sort.order}
  1306. { sort.label
  1307.   "    "
  1308.   year field.or.null sortify
  1309.   "    "
  1310.   title field.or.null
  1311.   sort.format.title
  1312.   #1 entry.max$ substring$
  1313.   'sort.key$ :=
  1314. ITERATE {bib.sort.order}
  1315. SORT             % by sort.label, year, title --- giving final bib. order.
  1316. FUNCTION {begin.bib}
  1317. { preamble$ empty$
  1318.     'skip$
  1319.     { preamble$ write$ newline$ }
  1320.   if$
  1321.   "\begin{thebibliography}{}" write$ newline$
  1322. EXECUTE {begin.bib}
  1323. EXECUTE {init.state.consts}
  1324. ITERATE {call.type$}
  1325. FUNCTION {end.bib}
  1326. { newline$
  1327.   "\end{thebibliography}" write$ newline$
  1328. EXECUTE {end.bib}
  1329.